//article模块的仓库
const state = () => ({
    //文章id
    artId:0,
    //文章评论对象数组
    comments:[],
    //评论总数
    commentsNum:0,
    // //点赞总数
    // likesNum:0,
    // //收藏总数
    // collectNum:0,
    //文章信息
    article:{},
})

//mutations是唯一修改state的地方
const mutations = {
    SET_COMMENTS: (state, comments) => {
        state.comments=comments
    },
    SET_ARTID:(state,artid)=>{
        state.artId=artid
    },
    SET_COMMENTSNUM:(state,num)=>{
        state.commentsNum=num
    },
    // SET_LIKESNUM: (state, num) => {
    //     state.likesNum = num
    // },
    // SET_COLLECTNUM: (state, num) => {
    //     state.collectNum = num
    // },
    SET_ARTICLE:(state,article)=>{
        state.article=article
    }
}

//action是用户处理派发action的地方，可以书写异步语句、逻辑的地方
const actions = {


}

const getters = {}
export default {
    namespaced: true,
    state,
    mutations,
    actions,
    getters
}